package com.jy.project.service.imp;

import com.jy.project.domain.MaterialAttrValue;
import com.jy.project.mapper.MaterialAttrValueMapper;
import com.jy.project.vo.MaterialAttrFieldVO;
import com.jy.project.vo.MaterialFieldValueVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import com.jy.project.service.MaterialAttrValueService;

import java.util.Date;
import java.util.List;

@Service
public class MaterialAttrValueServiceImpl implements MaterialAttrValueService {

    @Resource
    private MaterialAttrValueMapper materialAttrValueMapper;

    @Override
    public List<MaterialFieldValueVO> listMaterialAttrValue(String materialNo) {
        return materialAttrValueMapper.listMaterialAttrValue(materialNo);
    }

    @Override
    public void insertBatch(List<MaterialAttrValue> materialAttrValueList) {
        Date date = new Date();
        for (MaterialAttrValue materialAttrValue : materialAttrValueList) {
            materialAttrValue.setIsDelete(0);
            materialAttrValue.setCreateAt(date);
            materialAttrValue.setUpdateAt(date);
            materialAttrValueMapper.insert(materialAttrValue);
        }
    }
}
